#include<iostream>
#include<string>
using namespace std;

void checkminus(string str, int p1, int p2, int p3) {
    int n = str.length();
    for (int i = 0; i < n; i++) {
        if (str[i] != '-') {
            cout << str[i];
            continue;
        }
        // 检查是否越界
        if (i == 0 || i == n - 1) {
            cout << '-';
            continue;
        }
        char before = str[i - 1];
        char behind = str[i + 1];
        // 判断是否满足展开条件：同字母或数字，且behind > before
        bool is_same_type = (('a' <= before && before <= 'z' && 'a' <= behind && behind <= 'z')
            || ('0' <= before && before <= '9' && '0' <= behind && behind <= '9'));
        if (!is_same_type || behind <= before) {
            cout << '-';
            continue;
        }
        // 处理展开
        int count = behind - before - 1;
        if (p1 == 3) {
            for (int k = 0; k < count; k++) {
                for (int j = 0; j < p2; j++) {
                    cout << '*';
                }
            }
        } else {
            char start, end;
            if (p1 == 1) {
                start = before + 1;
                end = behind;
            } else if (p1 == 2) {
                if ('a' <= before && before <= 'z') {
                    start = before - 32 + 1;
                    end = behind - 32;
                } else { // 数字情况，p1=2时数字处理同p1=1
                    start = before + 1;
                    end = behind;
                }
            }
            // 处理顺序
            if (p3 == 1) {
                for (char ch = start; ch < end; ch++) {
                    for (int k = 0; k < p2; k++) {
                        cout << ch;
                    }
                }
            } else if (p3 == 2) {
                for (char ch = end - 1; ch > start - 1; ch--) {
                    for (int k = 0; k < p2; k++) {
                        cout << ch;
                    }
                }
            }
        }
    }
}

int main() {
    int p1, p2, p3;
    cin >> p1 >> p2 >> p3;
    string str;
    cin >> str;
    checkminus(str, p1, p2, p3);
    return 0;
}